package com.yu.java.se.reflect;

import com.sun.xml.internal.ws.util.StringUtils;
import com.yu.java.se.reflect.bean.User;

import java.lang.reflect.Field;

/**
 * @author wu
 * @create 2022-11-11-16:24
 */
public class EnumTest {
    public static void main(String[] args) throws IllegalAccessException {
        User user = new User();
        user.setUserId(1 + "");
        user.setAge("18");
        Class<? extends User> aClass = user.getClass();
        Field[] fields = aClass.getDeclaredFields();

        Common annotation = aClass.getAnnotation(Common.class);
        String tableName = annotation.value();

        String rowKey = "";
        for (Field field : fields) {
            rowkey annotation1 = field.getAnnotation(rowkey.class);
            if (annotation1 != null) {
                String family = annotation1.family();
                if (null != family) {
                    field.setAccessible(true);

                    rowKey = (String) field.get((Object) user);
                }

            }
            System.out.println(rowKey);
        }
        System.out.println(tableName);

    }
}
